<?
include_once("./_common.php");



if ($member[mb_id])
{
	$mb_id = $member[mb_id];
	$wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];
	$wr_password = $member[mb_password];
	$wr_email = $member[mb_email];
	$wr_homepage = $member[mb_homepage];
}
else
{
	$mb_id = "";
	// 비회원의 경우 이름이 누락되는 경우가 있음
	$wr_name = strip_tags(mysql_escape_string($_POST['wr_name']));
	if (!trim($wr_name))
		alert("이름은 필히 입력하셔야 합니다.");
	$wr_password = sql_password($wr_password);
}


$string = "qstr_id = '$mb_id',
	qstr_nm = '$wr_name',
	q_title = '$wr_subject',
	q_content = '$wr_content',
	q_date = '$g4[time_ymdhis]'
	";

if ($w == "")
{
	$sql = "INSERT
			INTO QNA_record
			SET $string";
	$rst = sql_query($sql);
}
else if ($w == "u")
{
	$sql = "UPDATE QNA_record
			SET $string
			WHERE id = '$id'";
	$rst = sql_query($sql);
}
else if ($w == "d")
{
	$sql = "DELETE
			FROM QNA_record
			WHERE id = '$id'";
	$rst = sql_query($sql);
}
$wr_id = mysql_insert_id();

if ($g4[https_url])
	$https_url = "$g4[url]/adm/adm_new";
else
	$https_url = ".";

if ($file_upload_msg)
	alert($file_upload_msg, "{$https_url}/qna_list.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);
else
	goto_url("{$https_url}/qna_list.php?bo_table=$bo_table&wr_id=$wr_id&page=$page" . $qstr);


?>